﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Share/Index.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <script src="../../Scripts/common/jquery.leanModal.min.js" type="text/javascript"></script>
        <style type="text/css">
        #lean_overlay { position: fixed; z-index: 100; top: 0px; left: 0px; height: 100%; width: 100%; background: #000; display: none; }
        #OpenWindow { font-size:12px; background: none repeat scroll 0 0 #FFFFFF; border-radius: 5px 5px 5px 5px; box-shadow: 0 0 4px rgba(0, 0, 0, 0.7); display: none; padding-bottom: 2px; width: 500px; z-index: 11000; left: 50%; margin-left: -202px; opacity: 1; position: fixed; top: 200px;}
        #OpenWindow-header { background: url("../../img/hd-bg.png") repeat scroll 0 0 transparent; border-bottom: 1px solid #eeeeee; border-top-left-radius: 5px; border-top-right-radius: 5px; padding: 10px; }
        #OpenWindow-header h2{margin-left:10px;}
        .modal_close { background: url("../../img/modal_close.png") repeat scroll 0 0 transparent; display: block; height: 14px; position: absolute; right: 12px; top: 12px; width: 14px; z-index: 2; }
 
        #OpenWindow .txt-fld { border-bottom: 1px solid #EEEEEE; padding: 8px 6px; position: relative; text-align: left; width: 444px;cursor:pointer;}
        #OpenWindow .txt-fld label { padding-left: 15px;color:Black;}
        </style>
        <script language="javascript" type="text/javascript">
            function _zx(id, card) {
                var _uctf_kf = $("input[name=uctf_fy]");
                var _uctf_yj = $("input[name=uctf_yj]");
                var _uctf_bz = $("input[name=uctf_bz]");
                var _btn = $("input[name=btnSetCard]");
                if (_uctf_kf.val() == "") {
                    alert("请填写退还费用");
                    _uctf_kf.focus();
                    return false;
                } else if (!/^(\-|\+)?\d+(\.\d+)?$/.test(_uctf_kf.val())) {
                    alert("退还费用格式不正确");
                    _uctf_kf.focus();
                    _uctf_kf.select();
                    return false;
                }
                if (_uctf_yj.val() == "") {
                    alert("请填写退还押金");
                    _uctf_yj.focus();
                    return false;
                } else if (!/^(\-|\+)?\d+(\.\d+)?$/.test(_uctf_yj.val())) {
                    alert("退还押金格式不正确");
                    _uctf_yj.focus();
                    _uctf_yj.select();
                    return false;
                }
                if (confirm("确定要注销卡：" + card + "?")) {
                    $.post("/userinfo/cardzx.html?" + (new Date()).getTime(), { id: id, card: card, fy: _uctf_kf.val(), yj: _uctf_yj.val(), bz: _uctf_bz.val() }, function (dta) {
                        if (dta == -1) {
                            alert("该卡还有未归还的图书不能注销");
                        } else {
                            alert("注销成功");
                            window.close();
                        }
                    });
                }
            }


            function detail(card, id) {
                $("#sutitle").html("注销会员卡[<span style='color:red;'>" + card + "</span>]");
                $("#btnSetCard").attr("ucid",id);
                $("#btnSetCard").attr("uccard",card);
            }

            $(function () {
                $('a[rel*=leanModal]').leanModal({ top: 100, closeButton: ".modal_close" });
            })
        </script>
             <table cellspacing="0" style="width:100%;">
             <tr>
             <th>卡号</th>
             <th>卡类型</th>
             <th>使用状态</th>
             <th>生效时间</th>
             <th>过期时间</th>
             <th>卡费</th>
             <th>押金</th>
             <th>备注</th>
             <th>借阅次数</th>
             <th>退还卡费</th>
             <th>退还押金</th>
             <th>原因</th>
             <th></th>
             </tr>
             <tbody id="usercardlist">
             <% 
                 string uid = Request["uid"].ToString();
                 DAL.Service.IUserInfoService user = new DAL.Service.Impl.UserInfoServiceImpl();
                 IList li = user.getUserCardList(int.Parse(uid));
                 foreach (Hashtable tb in li)
                 {
                     
              %>
                <tr>
                <td><%=tb["uc_card"]%></td>
                <td><%=Enum.GetName(typeof(DAL.Enums.cardType), int.Parse(tb["uc_chargemode"].ToString()))%></td>
                <td><%=Enum.GetName(typeof(DAL.Enums.cardstate), int.Parse(tb["uc_state"].ToString()))%></td>
                <td><%=tb["c_starttime"]%></td>
                <td><%=tb["c_endtime"]%></td>
                <td><%=tb["uc_kf"]%></td>
                <td><%=tb["uc_yj"]%></td>
                <td><%=tb["uc_bz"]%></td>
                <td><%=tb["usedTimes"]%></td>
                <td><%=tb["uctf_fy"]%></td>
                <td><%=tb["uctf_yj"]%></td>
                <td><%=tb["uctf_bz"]%></td>
                <td>
                <% 
                     if (tb["zxflag"].ToString() == "true")
                     {
                %>
                <a  href="#OpenWindow" rel="leanModal" onclick="javascript:detail('<%=tb["uc_card"] %>','<%=tb["uc_id"] %>');">注销卡</a>
                <% 
                     }    
                %>
                </td>
                </tr>
              <%   
                 }
              %>
             
             </tbody>
             </table>
 <div id="OpenWindow">
        <div id="signup-ct">
            <div id="OpenWindow-header">
                <h2 id="sutitle"></h2>
                <a href="#" class="modal_close"></a>
            </div>
 
            <div class="txt-fld" id = "cz">
            <table style="width:100%;border:1px;border-color:White;text-align:left;" cellpadding="0" cellspacing="0">
            <tr><td style="border:1px;border-color:White;">退还费用：<input type="text" name="uctf_fy" /></td></tr>
            <tr><td style="border:1px;border-color:White;">退还押金：<input type="text" name="uctf_yj" /></td></tr>
            <tr><td style="border:1px;border-color:White;">退卡原因：<input type="text" name="uctf_bz" /><input type="button" onclick="_zx($(this).attr('ucid'),$(this).attr('uccard'))" id="btnSetCard" value="注销" /></td></tr>
            </table>
            </div>
            <div style="height:20px;"></div>
         </div>
</div>
</asp:Content>
